7.06 图书列表页展示数据
1、mysql插入数据
desc book;
2、插入语句
insert book(id, title, price, publish_date, publisher, authors) values(01,“西游记”,9.9,”2023-10-19”,”李白”,”人民出版社”);
insert book(id, title, price, publish_date, publisher, authors) values(02,“三国演义”,19,”2023-10-19”,”罗贯中”,”高州出版社”);
insert book(id, title, price, publish_date, publisher, authors) values(03,“红楼梦”,19,”2023-10-19”,”曹雪芹”,”深圳出版社”);
html:
< !DOCTYPE html >
< html lang="en" >
< head >
< meta charset="UTF-8" >
< title > Title < /title >
< /head >
< body >
< table >
< thead >
< tr >
< th > ID < /th >
< th > 书名 < /th >
< th > 价格 < /th >
< th > 出版日期 < /th >
< th > 作者 < /th >
< th > 出版社 < /th >
< /tr >
< /thead >
< tbody >
{% for book in books %}
< tr >
< td > {{ book.id}} < /td >
< td > {{ book.title}} < /td >
< td > {{ book.price}} < /td >
< td > {{ book.publish_date}} < /td >
< td > {{ book.publisher}} < /td >
< td > {{ book.authors}} < /td >
< /tr >
{% endfor %}
< /tbody >
< /table >
< /body >
< /html >